<script setup lang="ts">
import MainLayout from '@/components/layouts/MainLayout.vue'
import NumberOperations from '@/components/NumberOperations.vue'
import NumberHistory from '@/components/NumberHistory.vue'
import NumberStats from '@/components/NumberStats.vue'
import { useAuth } from '@/composables/auth'

const { token } = useAuth()
</script>

<template>
  <MainLayout>
    <div class="number-view">
      <div class="game-info nes-container is-dark">
        <i class="nes-icon star is-medium"></i>
        <p>欢迎来到数字操作游戏！</p>
      </div>
      
      <div class="game-container">
        <NumberOperations :token="token" />
        <div class="game-stats">
          <NumberStats />
          <NumberHistory />
        </div>
      </div>
      
      <div class="game-help nes-container">
        <i class="nes-icon is-small heart"></i>
        <p>提示：你可以输入、更新或提交数字，并查看操作历史和统计</p>
      </div>
    </div>
  </MainLayout>
</template>

<style scoped>
.number-view {
  max-width: 800px;
  margin: 0 auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.game-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  color: #fff;
  font-size: 0.8rem;
}

.game-info i {
  flex-shrink: 0;
}

.game-container {
  display: grid;
  gap: 2rem;
  grid-template-columns: 1fr;
}

.game-stats {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.game-help {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  font-size: 0.7rem;
  border-style: dashed;
}

.game-help i {
  flex-shrink: 0;
}

/* 动画效果 */
.nes-icon.star {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

/* 响应式调整 */
@media (max-width: 768px) {
  .number-view {
    padding: 0.5rem;
    gap: 1rem;
  }
  
  .game-info, .game-help {
    font-size: 0.7rem;
  }
}

@media (min-width: 1024px) {
  .game-container {
    grid-template-columns: 1fr 300px;
  }
}
</style> 